<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style type="text/css">
*{margin:0;padding:0;font-size:12px !important;}
.p1,.p2,.p3,.des{font-size:16px !important;}
.input-text:hover{border:1px solid red;}
.pp{width:100%;height:220px;}
.p5{width:100%;height: 40px;text-align: center;font-size: 20px !important;margin: 30px auto;color: #0f77ec;}
.p6{width:100%;height: 30px;margin: 0auto;text-align: center;font-size: 16px !important;}
.pa{width: 118px !important;height: 30px !important;border: 1px solid #ddd;background: #1b50bc;display: inline-block;margin-left:10px;line-height:30px;color:#fff;
}
.pa:hover{opacity:0.8}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" href="<%=basePath%>css/paimai1.css">
    <link rel="stylesheet" href="<%=basePath%>css/common_new.min.css">
    <link rel="stylesheet" href="<%=basePath%>static/css/owl.carousel.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/index.css">
    <link rel="stylesheet" href="<%=basePath%>static/layer/2.4/skin/layer.css">
    <script type="text/javascript" src="<%=basePath%>js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
    <script src="<%=basePath%>static/js/owl.carousel.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/vue.min.js"></script>

</head>

<body>
    <!-- 顶部导航栏 -->
    <section>
     <div id="header">
        <div class="navbar">
          <div class="navbar-content">
            <jsp:include page="yeah-top.jsp"/>
          </div>
        </div> 
       
            <div class="daohang">
                <a href="<%=basePath%>">首页</a>
                <span>></span>
                <a href="tobid">竞价</a>
                <span>></span>
                <a href="javascript:void(0)">当前竞价</a>
            </div>
        </div>
    </section>

    <section>
        <div class="zhuti">
           <div class="zhuti1">
               <img src="${bid.img_url }" alt="竞价商品的图片">
           </div>
           <div class="zhuti2">
            
            <div class="des">
            <h2>${bid.classifyname}&nbsp;${bid.model }</h2>
            <div>竞价商品的描述</div>
            <div>${bid.biddes }</div>
            </div>
              <div class="pp"><p class="p1">当前价<span>￥<b id="jiage">${bid.lowprice }</b></span></p>
              <input id="bid" type="hidden" value="${bid.bid }">
               <p class="p2">预计  <span>${bid.delivery_time }</span>结束</p>
               <p class="p3">出价 <input class="input-text" type="text"/></p>
             <button class="but1">竞价</button></div>
               <p class="p4">竞价规则： 至少一人报名且出价不低于起拍价 ，方可成交</p>
           </div>
      </div> 
    </section>

    <!-- 底部 -->
    <section>
        <div class="web_bot">
            <p class="li1">
                <span>
                    <a href="#">关于我们</a>
                </span> |
                <span>
                    <a href="#">关于我们</a>
                </span> |
                <span>
                    <span>
                        <a href="#">关于我们</a>
                    </span> |
                    <span>
                        <a href="#">联系我们</a>
                    </span>
            </p>
            <p class="li2">
                <span>
                    <a href="#">沪ICP备17036439号</a>
                </span> |
                <span>
                    <a href="#">沪ICP备17036439号-2</a>
                </span> |
                <span>
                    <span>
                        <a href="#">上海瓜叶网络科技有限公司</a>
                    </span>
            </p>
        </div>
        <script>
    $(function () {
        $(".but1").click(function () {
        	var re =/^[1-9]\d*$/;
            var bid =$("#bid").val();
            var y=parseInt($("#jiage").html().split(".")[0]);
            var inpt =$(".input-text").val().trim();
            var x;
            if((inpt!="")&&(re.test(inpt))){
             x=parseInt(inpt);
            if(y>x){
            	
               layer.msg("竞价金额需大于当前价格",{icon:2,time:2000});
                
             }else{
             	
              $.ajax({
             	url:"bid_s",
             	type:"post",
             	data:{
             		bid:bid,
             		bidprice:x
             		},
             	dataType:"json",
             	success:function(data){
             		//去竞价成功页面
             		alert(data.flag);
             		if(data.flag){
             		$(".but1").css("display","none");
             		$(".p3").css("display","none");
             		$(".pp").append('<div class="p5">竞价成功!&nbsp;您出价:￥'+x+'</div>');
             		$(".pp").append('<div class="p6"><a class="pa" href="tobid">了解其他竞价商品</a><a class="pa" href="<%=basePath%>">耶回收首页</a></div>');
             		}else{
             			
             		layer.msg("您已经出过价了，不能重复出价！",{icon:2,time:2000} );	
             		}
             	 } 
              })
             
               }
            }else{
            	layer.msg("请输入一个正确的金额",{icon:2,time:2000});
               
                }
    
        })
        
    })
        </script>
    </section>
</body>
</html>